package com.shanghaionstar.carmanage.adapter;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.onstar.cn.framework.annotation.FindViewById;
import com.onstar.cn.framework.base.CommonAdapter;
import com.onstar.cn.framework.base.CommonViewHolder;
import com.onstar.cn.weight.CustomImageView;
import com.shanghaionstar.R;
import com.shanghaionstar.carmanage.model.ChargeModeItem;

import java.util.List;

/**
 * Created by 6335yz on 2016/7/24.
 */
public class ChargeModeAdapter extends CommonAdapter<ChargeModeItem> {
    private class ViewHolder extends CommonViewHolder {
        @FindViewById
        CustomImageView charge_mode_item_iv2;
        @FindViewById
        TextView charge_mode_item_tv1, charge_mode_item_tv2;
        @FindViewById
        LinearLayout charge_mode_item_ll;
    }

    public ChargeModeAdapter(List datas, Context context) {
        super(datas, context);
    }

    @Override
    public void getView(int position, CommonViewHolder viewHolder) {
        ViewHolder holder = (ViewHolder) viewHolder;
        ChargeModeItem item = datas.get(position);
        // holder.charge_mode_item_iv1.setImageResource(item.resId);
        holder.charge_mode_item_tv1.setText(item.title);
//			holder.charge_mode_item_tv2.setText(item.desc);
        if (item.selected) {
            holder.charge_mode_item_iv2.setVisibility(View.VISIBLE);
        } else {
            holder.charge_mode_item_iv2.setVisibility(View.GONE);
        }
    }

    @Override
    public int layoutId() {
        return R.layout.car_charge_mode_option_item;
    }

    @Override
    public CommonViewHolder getViewHolder() {
        return new ViewHolder();
    }
}
